﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.Modeling.Diagrams;

namespace UofCASE.AgileProductLinerDSL {
    class CustomExpCollapseField : TextField {

        public CustomExpCollapseField(string fieldName) : base(fieldName) {
        }

        public override string GetDisplayText(ShapeElement parentShape) {
            
            if (parentShape is FeaturePortShape) {
                FeaturePortShape fPortShape = parentShape as FeaturePortShape;
                if (fPortShape.IsCollapsed) return "+";
            } else if (parentShape is TestPortShape){
                TestPortShape tPortShape = parentShape as TestPortShape;
                if (tPortShape.IsCollapsed) {
                    this.AnchoringBehavior.SetLeftAnchor(AnchoringBehavior.Edge.Left, 0.01);
                    return "+";
                } else {
                    this.AnchoringBehavior.SetLeftAnchor(AnchoringBehavior.Edge.Left, 0.015);
                    return "-";
                }
            }
            return "";
        }

        public override bool GetSelectable(ShapeElement parentShape) {
            return false;
        }

        public override bool GetFocusable(ShapeElement parentShape) {
            return false;
        }

        public override bool CanEditValue(ShapeElement parentShape, DiagramClientView view) {
            return false;
        }

    }
}
